/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * This file is part of JMail                                              *
 * Copyright (C) 2002-2003 Yvan Norsa <norsay@wanadoo.fr>                  *
 *                                                                         *
 * JMail is free software; you can redistribute it and/or modify           *
 * it under the terms of the GNU General Public License as published by    *
 * the Free Software Foundation; either version 2 of the License, or       *
 * any later version.                                                      *
 *                                                                         *
 * JMail is distributed in the hope that it will be useful,                *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 * GNU General Public License for more details.                            *
 *                                                                         *
 * You should have received a copy of the GNU General Public License along *
 * with JMail; if not, write to the Free Software Foundation, Inc.,        *
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                 *
 *                                                                         *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

import java.io.*;

/** An entry in the address book */
final class Entry
{
    /** Name of the entry */
    private String name;

    /** Email of the entry */
    private String email;

    /** Constructor
     *  @param name name to be added
     *  @param email email to be added
     */
    protected Entry(String name, String email)
    {
	this.name = name;
	this.email = email;
    }

    /** Returns the name of the entry
     *  @return name
     */
    protected final String getName()
    {
	return(name);
    }

    /** Returns the email of the entry
     *  @return mail
     */
    protected final String getEmail()
    {
	return(email);
    }

    /** Save the entry to disk
     *  @param output output stream to be writed to (the user profile)
     */
    protected final void writeTo(PrintWriter output)
    {
	output.println("<Entry name=\"" + name + "\" email=\"" + email + "\"/>");
    }

    /** Converts the entry to a string
     *  @return a string containing the entry "name <email>"
     */
    public final String toString()
    {
	return(name + " <" + email + ">");
    }
}
